Introduction

Column

Introduction:

Music is an essential part of many people’s lives, and with digital music streaming platforms like Spotify, discovering new music has become more accessible than ever. Spotify’s algorithm suggests playlists based on users’ listening habits and preferences. One of the most popular playlists on Spotify is “New Music Friday,” updated every week with new releases from various artists. It is curated by Spotify’s editorial team, who select the latest and most popular releases from various genres. However, the question remains: how accurately does this playlist align with personal musical taste and style?

As a student and an avid music lover, I have always been curious about the mechanics behind music recommendations. This final portfolio explores the inner workings of Spotify’s music recommendation algorithm, attempting to create a predictive model that accurately predicts a user’s preferred musical genres and styles. The analysis will focus on two playlists - “Songs I Like” and “Songs I Dislike” - to identify patterns in personal musical taste. The “Songs I Like” playlist is a collection of songs that hold personal meaning, representing various genres such as pop, 70s, 80s, 90s musical, and rock. In contrast, the “Songs I Dislike” playlist consists of heavy metal and drill rap songs that do not match personal taste.

By analysing the features of songs in both playlists, this portfolio aims to provide insights into personal musical preferences and use this information to train a machine learning model. The goal is to create a predictive model that accurately predicts preferred musical genres and styles. Additionally, the analysis will investigate whether this model can predict which songs from popular playlists like “New Music Friday” would resonate with the user, allowing for a more personalized and tailored listening experience.

Background:

The tracks chosen for this portfolio come from a personal selection of songs representing the music I enjoy and the genres I tend to avoid. This decision was made to provide a diverse and authentic dataset for the machine learning model. By examining these songs, the portfolio seeks to answer the following questions:

  1. What are the key features that differentiate songs from the “Songs I Like” and “Songs I Dislike” playlists?
  2. Can a machine learning model be trained to predict personal musical preferences based on these features?
  3. How effectively can the trained model predict which songs from popular playlists, such as “New Music Friday,” will align with my personal taste?

Column

Corpus: Songs I like

iframe src=“https://open.spotify.com/embed/playlist/6pl0C7qbIl5uoY3Tdf82oa?utm_source=generator” width=“100%” height=“100%” frameBorder=“0” allowfullscreen=“” allow=“autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture”>

Column

Corpus: Songs I dislike

iframe src=“https://open.spotify.com/embed/playlist/4bJQX5w7W4wEnHLmWqUIVY?utm_source=generator&theme=0” width=“100%” height=“100%” frameBorder=“0” allowfullscreen=“” allow=“autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture”>

Feature analysis

Relationship between Valence, Energy, Loudness, and Mode for the songs I like


Spotify’s track-level features, such as valence, danceability, energy, and loudness, offer valuable insights into the underlying patterns of my personal music preferences. I selected these features as they are commonly used to describe the overall mood, intensity, and emotional tone of a song, allowing us to better understand the characteristics that define the songs I like and dislike (Serra et al.). By examining these features, we can gain a deeper understanding of the traits that influence my musical taste.

Based on the first scatterplot, it seems like I tend to like songs that are loud. I also seem to be drawn to songs that are high-energy, as they’re clustered towards the upper portion of the plot where the energy values are high.

As for the valence of the songs I like, it appears to be centered around 0.5, but mostly falls between 0.5 and 1.0. This suggests that I tend to prefer songs with a positive emotional valence, which could contribute to their appeal.

One interesting thing I noticed in the plot is that the songs I like are equally distributed between major and minor keys, as indicated by the color coding in the plot. This suggests that the mode of the songs I like doesn’t strongly influence my preference for them.

Relationship between Valence, Energy, Loudness, and Mode for the songs I dislike


Looking at the scatterplot of songs I don’t like, I can see that they’re usually not as loud as the songs I enjoy. Even though they still have high energy levels, they often have lower valence. This makes me believe that I might like songs that have a more positive and uplifting vibe, rather than ones that are more downbeat or sad.

It’s interesting to see that, just like the songs I like, the songs I don’t like are spread out pretty evenly between major and minor keys. This tells me that the key of a song doesn’t really play a big role in whether I like it or not.

Another thing I noticed is that the songs I don’t like seem to have a smaller range of energy compared to the songs I do like. This could mean that I’m more open to different levels of intensity and dynamics when it comes to music I enjoy, while the music I don’t like might have more in common in terms of how energetic they are.

Zooming in on Valence


This plot provides a visual representation of how valence is distributed among two different sets of songs: ‘Songs I like’ and ‘Songs I dislike’.

Valence is a measure of how positive or negative a musical piece sounds, with a scale that ranges from negative to positive values. The plot shows two histograms, one in light blue representing the valence distribution for the songs that I like, and the other in light coral representing the valence distribution for the songs that I dislike.

By looking at the plot, we can see that the valence distribution for the songs that I like is skewed towards the positive end of the spectrum, indicating that the songs the I like tend to have a more positive sound. In contrast, the valence distribution for the songs that I dislike is more skewed towards the negative end of the spectrum, suggesting that the songs I dislike have a more negative sound.

Zooming in on Energy


This plot provides insight into the energy distribution of two different sets of songs: ‘Songs I like’ and ‘Songs I dislike’. Energy is a measure of how intense and active a musical piece is, with a scale that ranges from low to high values. The plot displays two histograms, one in light green representing the energy distribution for the songs that I like, and the other in coral representing the energy distribution for the songs that I dislike.

Upon examining the plot, we can see that the energy distribution for the songs that I like is concentrated between 0.7 and 0.9, with a peak around 0.8. This indicates that the songs that I enjoy tend to have a moderate level of energy, without being too intense or too mellow. In contrast, the energy distribution for the songs that I dislike is concentrated around 0.95, indicating that the songs that I find unfavorable tend to be more energetic.

The findings of this plot suggest that energy may be an important factor in shaping my musical preferences. However, it is essential to note that energy is just one of many factors that can influence an individual’s musical tastes.

Zooming in on Loudness


Musical preferences are complex and can be influenced by various factors, including the loudness of a musical piece. Loudness is an essential characteristic of music that can affect how it is perceived by the listener. It refers to the volume or intensity of a musical piece and is typically measured in decibels.

The plot that highlights the difference in loudness between songs that I like and songs that I dislike may provide insight into how loudness influences my musical preferences. The plot may indicate that my preferred songs tend to be louder than songs that I dislike, suggesting that loudness is an essential characteristic of my musical taste. However, it is crucial to remember that loudness is just one factor that can influence musical preferences.

It is worth noting that loudness is not always a reliable indicator of a songs quality or emotional impact. A quiet ballad or a soothing instrumental piece can be just as powerful and moving as a loud and energetic track. Therefore, while loudness may be an important characteristic of my preferred songs, it should not be the only factor considered when evaluating the quality or emotional impact of a musical piece.

Track-Level Summary

Overview

In any portfolio, selecting appropriate samples is crucial in effectively achieving the portfolio objectives. In the present portfolio, a broad range of samples was chosen, including diverse data related to the research question. However, the large volume of data made it challenging to identify significant patterns or trends that could adequately address the research question.

To overcome this challenge, the decision was made to focus on the outliers in the portfolio. Specifically, the analysis focused on the extreme cases that were most divergent from the norm in terms of a specific component. This approach allowed for the isolation and study of the outliers, leading to valuable insights and a better understanding of the factors contributing to their unique characteristics. Ultimately, this approach strengthened the analysis and enhanced the quality of the portfolio.

In this portfolio, timbre, the quality of sound that distinguishes different musical instruments, was analyzed using spectral content, which measures the relative strengths of various frequency components that make up the sound. The portfolio focused on a specific timbre component, which was used to isolate and study the outliers in the samples.

To further investigate this approach, tables were generated to identify the maximum and minimum values of specific timbre components for each sample. The tables for the maximum and minimum values of c01, c02, c03, and c04 for both the ‘Songs I like’ and ‘Songs I dislike’ samples showed notable differences in timbre components between the two sets of samples. For example, the table of maximum and minimum values of c02 for each set of samples showed that the highest and lowest timbre values for ‘Songs I like’ were exhibited by the samples ‘What I Like About You’, and ‘The Sailor’s Warning’, respectively, while the highest and lowest timbre values for ‘Songs I dislike’ were exhibited by the samples ‘Murder’ and ‘19 Tini 5’, respectively., respectively.

These tables provide insight into how specific timbre components differ between the two sets of samples, which helps to support the approach of focusing on the outliers in the portfolio to gain valuable insights into timbre characteristics.

Column 2

Timbre components

c01

Table of maximum and minimum values of c01 for each playlist
Playlist Track Artists value
Songs I dislike Street Sense Shawty Pimp, MC Spade 37.45836
Songs I like Africa TOTO 36.25328
Songs I dislike 1984 Slaughter to Prevail 55.58922
Songs I like Starstruck Years & Years 54.76817

c02

Table of maximum and minimum values of c02 for each playlist
Playlist Track Artists value
Songs I dislike 19 Tini 5 TiniMaine -81.27966
Songs I like The Sailor’s Warning Faela -34.36908
Songs I dislike Murder (feat. Tom Skeemask & GK) DJ Squeeky, Tom Skeemask, GK 145.18006
Songs I like What I Like About You The Romantics 109.29211

c03

Table of maximum and minimum values of c03 for each playlist
Playlist Track Artists value
Songs I dislike Street Sense Shawty Pimp, MC Spade -109.32972
Songs I like Think About Things Daði Freyr -44.19746
Songs I dislike Wounds ColdWorld 59.98358
Songs I like golden hour JVKE 69.93170

c04

Table of maximum and minimum values of c04 for each playlist
Playlist Track Artists value
Songs I dislike 2 Thick DJ Zirk, Tha 2thick Family, Tom Skee, BuckShotz -40.84057
Songs I like The Sailor’s Warning Faela -25.60552
Songs I dislike LIVING LEGEND Scarlxrd 30.74823
Songs I like The Way You Make Me Feel - 2012 Remaster Michael Jackson 29.41128

Chromagrams

Text about chromagrams

Chromagrams are powerful tools for analyzing the harmonic content and structural features of music. In this portfolio, we examined two songs from my musical corpus: “What I Like About You” from the playlist ‘Songs I Like’ and “Murder” from the playlist ‘Songs I Dislike’. These songs were analyzed using their respective chromagrams to gain insight into their harmonic structures and to better understand my personal musical preferences.

“What I Like About You” by The Romantics has a simple harmonic structure that consists of the chords A, G#, E, and D. The corresponding chromagram for this song shows a clear and consistent distribution of these pitches. This simple harmonic structure may contribute to why I enjoy this song and have included it in my ‘Songs I Like’ playlist.

On the other hand, “Murder” has a more complex harmonic structure that includes frequent modulations but tends to avoid the pitches C# and C. The chromagram for this song displays a diverse distribution of pitches, indicating a more intricate harmonic structure and chord progression. This variation in pitch distribution may be the reason why I dislike this song and have included it in my ‘Songs I Dislike’ playlist.

By comparing the chromagrams of these two songs, we can gain insights into the underlying harmonic structures that contribute to my personal musical taste. The analysis of chromagrams allows us to identify commonalities and differences between songs, which can be used to curate playlists that align with our individual musical preferences.

Chromagrams

Ceptrograms

Text about ceptrograms

Ceptrograms are an essential tool for analyzing the timbral characteristics of a musical recording. A ceptrogram provides a visual representation of the distribution of timbral characteristics such as brightness, warmth, and depth in a song. By comparing the ceptrograms of two songs, we can gain insights into the similarities and differences in their timbral characteristics and use this knowledge to better understand our personal musical preferences.

In this portfolio, we analyzed two songs from my corpus, “Shut Up and Dance” from the ‘Songs I Like’ playlist and “State of Unrest” from the ‘Songs I Dislike’ playlist, using their respective ceptrograms to understand their timbral structures and to gain insights into why I might have included them in their respective playlists.

Upon analyzing the ceptrogram of “Shut Up and Dance,” we observed a strong presence around the c01 and c02 timbre coefficients. These coefficients indicate that the song has a bright and loud timbral quality, which may contribute to why I enjoy listening to it and why it is included in my ‘Songs I Like’ playlist.

On the other hand, “State of Unrest” exhibits a similar distribution of timbral characteristics as “Shut Up and Dance,” with a strong presence around the c01 and c02 timbre coefficients. However, this song is included in my ‘Songs I Dislike’ playlist, indicating that timbre is not the main factor that determines my musical preferences.

In conclusion, the analysis of ceptrograms for the songs “Shut Up and Dance” and “State of Unrest” provides us with insights into their timbral structures and how they may contribute to our personal musical preferences. While “Shut Up and Dance” exhibits a bright and loud timbral quality that may explain why it is included in the ‘Songs I Like’ playlist, “State of Unrest” has a similar distribution of timbral characteristics but is included in the ‘Songs I Dislike’ playlist, indicating that other factors beyond timbre play a role in determining our musical preferences.

Ceptrograms

Tempograms

Text about tempograms

Tempo, which refers to the speed or pace of a piece of music, is an essential aspect that greatly influences listeners’ perception and emotional response to music. Some songs have a slow and steady tempo that can evoke feelings of calmness and relaxation, while others have a fast and upbeat tempo that may evoke feelings of excitement and energy. Tempograms are visual representations of the tempo fluctuations in a piece of music over time. They provide a useful tool for analyzing and comparing the tempo patterns of different songs, allowing us to gain insights into the structure and dynamics of musical compositions.

To explore the range of tempos in the ‘Songs I like’ playlist, I have selected two songs with the highest and lowest tempos, namely ‘High Hopes’ by Panic! At The Disco with a tempo of 82.014 and ‘Fascination’ by Alphabeat with a tempo of 193.968. These songs offer a glimpse into the variety of tempos found in the playlist and provide an opportunity to observe any tempo changes in slow and fast songs.

Upon analyzing the Tempograms, it can be observed that both songs maintain a relatively consistent tempo with occasional variations. ‘High Hopes’ mostly maintains a tempo of around 80 BMP, while ‘Fascination’ hovers around 98 BPM. However, ‘High Hopes’ displays more frequent tempo changes compared to ‘Fascination.’

In conclusion, the selected songs from the ‘Songs I like’ playlist offer insights into the range of tempos in music that I enjoy. The Tempogram analysis has also revealed interesting patterns in tempo fluctuations, which can further enhance our understanding of the role of tempo in music taste.

Tempograms

Self-similarity Matrices

text over SSM

A self-similarity matrix is a visual representation of the similarity between different sections of a musical recording. This tool allows us to observe and analyze the internal structure of a song in a way that provides valuable insights into its musical composition and arrangement. By comparing the self-similarity matrices of two songs, one I like a lot and one I dislike, “Shut Up and Dance” and “State of Unrest” in both timbre and chroma, we can gain a deeper understanding of how these songs are structured and how they differ from each other.

When analyzing the self-similarity matrix for the timbral characteristics of the songs, we can see variations in the repetition of certain musical motifs. These motifs could be rhythmic patterns, melodies, or harmonies that repeat throughout the song, providing a sense of continuity and coherence. In the case of “State of Unrest” and “Shut Up and Dance,” we can see that the two songs differ in terms of the frequency and regularity of these motifs. “Shut Up and Dance” has a more consistent and structured pattern of repetition, while “State of Unrest” has a less predictable and more sporadic one.

Similarly, the chroma self-similarity matrix provides insights into how the songs’ chord progressions and tonal centers change over time. This information is particularly valuable in understanding the harmonic structure of a song, which is essential in determining its overall mood and emotional impact. In the case of “State of Unrest” and “Shut Up and Dance,” we can see that the two songs differ in terms of their harmonic complexity and diversity. “Shut Up and Dance” has a more straightforward and predictable harmonic structure, while “State of Unrest” explores a wider range of harmonic possibilities.

One notable difference between the two songs is that, around the 150-second mark, the bridge section in “Shut Up and Dance” is clearly visible in both timbre and chroma self-similarity matrices, while in “State of Unrest,” this section is less structured and organized.

Through this analysis, I can see that “Shut Up and Dance” follows a more traditional song structure, with a clear and predictable form that includes defined verses, choruses, and bridges. In contrast, “State of Unrest” may have a more unconventional arrangement, with a less predictable and more sporadic pattern of repetition. While both songs have their unique qualities, I tend to respond positively to songs that have a clear and familiar structure, and this could be one of the reasons why I find “Shut Up and Dance” more appealing than “State of Unrest.”

SSM

column3

Trained Model

Unlocking the secrets of my playlist: A decision tree classification model investigation


Finally, I trained a decision tree classification model on the two playlists (‘Songs I like’ and ‘Songs I dislike’). I used all the features except for key and timbre components, as including them decreased recall and precision. During the analysis, I performed 5 cross-validations to ensure the model’s accuracy. As can be seen in the plot, instrumentalness seems to be the most important feature, followed by speechiness. Finally, acousticness and energy are also important. Overall, it can be concluded that I like songs with low instrumentalness, low speechiness, and energy levels below 0.89, as shown in the feature analysis.

Valuation of model performance using recall and precision metrics


After training the model, I evaluated its performance by applying it to the original dataset and calculating its recall and precision. Recall is the proportion of true positive predictions (i.e., correctly classified songs I like and songs I dislike) to the total number of actual positive cases, while precision is the proportion of true positive predictions to the total number of predicted positive cases.

The confusion matrix showed that the model performed best at classifying songs I like, but it also had a decent performance in classifying songs I dislike. Overall, the model’s accuracy was fairly good, as demonstrated by the table below.

Precision and Recall of the Decision Tree classifying the corpus
class precision recall
Song I dislike 0.8146341 0.8146341
Songs I like 0.8675958 0.8675958

Testing the model on the New Music Friday (NL) Spotify playlist to evaluate its ability to make accurate predictions based on my music preferences

Track name Labeled as The model predicted
Layla Songs I like Songs I like
Voor Mijn Hart Songs I like Songs I like
Er Was Eens Een Meid Songs I like Songs I like
Call on Me Songs I like Songs I like
Substitution Songs I like Song I dislike
Dit Moet Verliefd Zijn Songs I like Songs I like
Say Say Say (feat. Paul McCartney & Michael Jackson) Songs I like Songs I like
Padellen Songs I like Song I dislike
Part Of Me Songs I like Songs I like
Beautiful Ride Songs I like Songs I like
What You Got (Ayo) Songs I like Songs I like
DOGTOOTH Song I dislike Song I dislike
On & On Song I dislike Song I dislike
Het Feest Is Al Voorbij Song I dislike Songs I like
Droom Song I dislike Songs I like
06 Gucci (feat. DaBaby & 21 Savage) Song I dislike Song I dislike
Thunder Glove Song I dislike Songs I like
Possessed Song I dislike Song I dislike
Faster Song I dislike Song I dislike
VOID Song I dislike Song I dislike

As a final test of my decision tree classification model, I wanted to see how it would perform on an unknown playlist. To achieve this, I hand-labeled the first 20 songs of the Spotify playlist ‘New Music Friday (NL),’ indicating which songs I would like and which ones I would dislike.

Next, I used the model to classify the songs based on their features and compared its predictions to my own labels. The results of this test are shown in the table on the left.

Overall, the model performed well, correctly identifying 15 out of the 20 songs in the playlist as either songs I would like or dislike. This provides further evidence that the model is a useful tool for understanding my music preferences and could be applied to other playlists or datasets.

Viewing the metrics of the model performance on the New Music Friday (NL) Spotify playlist


The results of the previous model performance evaluation can be observed in the data presented here. The analysis indicates that the model was slightly more successful in predicting whether I would like a song, as opposed to predicting whether I would dislike a song. Despite this, the model performed well overall and was able to accurately classify a majority of the songs in the New Music Friday (NL) Spotify playlist.

Precision and Recall of the Decision Tree classifying the ‘New Music Friday (NL)’ playlist from Spotify
class precision recall
Song I dislike 0.6666667 0.75
Songs I like 0.8181818 0.75

Conclusion

Column 1

Conclusion:

After a comprehensive analysis of my music preferences using various tools and techniques, I have gained valuable insights into the factors that influence my musical taste. Through the analysis of chromagrams, ceptrograms, tempograms, and self-similarity matrices, I have been able to observe the harmonic and timbral characteristics of different songs, as well as the impact of tempo and song structure on my preferences.

The results have revealed key features that differentiate between the “Songs I Like” and “Songs I Dislike” playlists, with low instrumentalness, low speechiness, and energy levels below 0.89 being the most important features in songs that I like. Moreover, the analysis of self-similarity matrices showed that I tend to prefer songs with a clear and familiar structure, while also appreciating songs with unconventional arrangements.

The decision tree classification model was successfully trained to predict personal musical preferences based on these identified features. The model was evaluated using the original dataset and was able to accurately classify a majority of the songs into either the “Songs I Like” or “Songs I Dislike” playlists. Furthermore, the model was tested on an unknown playlist (“New Music Friday”) and was able to predict which songs would align with my personal taste with a high level of accuracy.

The results of this analysis have implications for music streaming platforms such as Spotify, as they provide insights into users’ preferences and allow for more personalized music recommendations. Additionally, music producers and composers could use these conclusions to better understand the elements that make up popular songs and to tailor their compositions to appeal to specific audiences.

Overall, this study has provided me with a better understanding of my music preferences, and has highlighted the importance of various musical features in determining my preferences. The success of the decision tree classification model in predicting my personal musical preferences also demonstrates its potential utility for predicting the preferences of other listeners.

Column 1

References:

Baker, D. J. (@davidjohnbaker1) & Burgoyne, J. A. (@jaburgoyne). (2023). compmus2023. GitHub repository. https://github.com/jaburgoyne/compmus2023

Müller, M. (2015). Fundamentals of music processing: Audio, analysis, algorithms, applications. Springer.

Serrà, J., Corral, Á., Boguñá, M., Haro, M., & Ll Arcos, J. (2012). Measuring the evolution of contemporary western popular music. Scientific Reports, 2, 521. https://doi.org/10.1038/srep00521

spotifyr package. (n.d.). Spotify Developer. Retrieved September 12, 2023, from https://developer.spotify.com/